package com.quartet.modules.order.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.quartet.modules.order.entity.TOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 订单表(TOrder)表数据库访问层
 *
 * @author makejava
 * @since 2021-05-04 16:40:23
 */
@Mapper
public interface TOrderDao extends BaseMapper<TOrder> {

    /**
     * 查询15天后过期的订单
     *
     * @return
     */
    @Select("select * from t_order where timestampdiff(day ,sysdate(),expire_time)=15")
    List<TOrder> queryFifteenExpire();

    /**
     * 查询接入应用的个数
     *
     * @return
     */
    @Select("select count(1) from (select application_type from t_order group by application_type) temp")
    int queryApplicationCount();
}
